package com.bwie.auth.config;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author
 * @description: 远程调用服务的熔断
 * @Date 2022-10-15 上午 08:42
 */
@Component
public class UserRequestFactory implements FallbackFactory<UserRequestFactory> {

    private final static Logger log = LoggerFactory.getLogger(UserRequestFactory.class);

    @Override
    public UserRequestFactory create (Throwable cause) {
        log.error("用户服务-远程调用异常", cause);
        return new UserRequestFactory() {

            public UserRequestFactory syncList (int pageSize, int syncNum, UserRequestFactory mallProductInfo) {
                UserRequestFactory tableDataInfo = new UserRequestFactory();
                log.info("远程调用失败，错误信息:[{}]");
                tableDataInfo.create(cause);
                return null;
            }


        };
    }
}
